package com.globallogic.strelchuk.multi.util;

/**
 * @author olena.strelchuk
 */

/**
 * Multiply values recursively
 */
public class Multiplicator {

	/**
	 * Recursive method for performing Multiplication
	 * 
	 * @param firstNumber
	 *            first number to multiply
	 * @param secondNumber
	 *            second number to multiply
	 * @return Returns result of multiplication between firstNumber and
	 *         secondNumber
	 */
	public static int doMultiply(int firstNumber, int secondNumber) {

		int result;
		if (secondNumber == 1) {
			result = firstNumber; // stopping case of recursion
		} else {
			result = firstNumber + doMultiply(firstNumber, secondNumber - 1);
		}
		return result;
	}
}
